<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>地图demo</title>
    <link type="text/css" rel="stylesheet" href="css/MapGis.css" />
    <script type="text/javascript" src="jquery.min.js" ></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=tXStBlc74VxClyLQcRo98OPiKcMTzvj2">
    //v2.0版本的引用方式：src="http://api.map.baidu.com/api?v=2.0&ak=wMZsrqiG6v2Fkw5r4i1ezw7o4TiPa519"
    </script>
    <script src="js/liGis.js"></script>
    <style type="text/css">
        *{
            padding: 0;
            margin:0;
        }
        html,body{
            height: 100%;
            width:100%;
        }
		
    </style>
</head>
<body>
    <div id="container" style="width: 100%;height: 100%;"></div>
    <script type="text/javascript">
        $(function(){
            var test1=[{"lng":116.422972,"lat":40.056746},{"lng":116.5713,"lat":40.009899},{"lng":116.513809,"lat":39.912565},{"lng":116.349958,"lat":39.934256},{"lng":116.322362,"lat":40.032442},{"lng":116.363756,"lat":40.047025},{"lng":116.363756,"lat":40.047025},{"lng":116.363756,"lat":40.047025}]
            var test2=[{"lng":116.589698,"lat":39.97054},{"lng":116.782869,"lat":39.99575},{"lng":116.763897,"lat":39.90061},{"lng":116.666736,"lat":39.841689},{"lng":116.616719,"lat":39.870492},{"lng":116.563252,"lat":39.932928},{"lng":116.563252,"lat":39.932928},{"lng":116.570726,"lat":39.940895},{"lng":116.570726,"lat":39.940895},{"lng":116.570726,"lat":39.940895}]
            var test3=[{"lng":116.274644,"lat":39.774289},{"lng":116.422972,"lat":39.802676},{"lng":116.409174,"lat":39.735237},{"lng":116.265445,"lat":39.728135},{"lng":116.23095,"lat":39.776507},{"lng":116.26487,"lat":39.7805},{"lng":116.26487,"lat":39.7805},{"lng":116.26487,"lat":39.7805}]
            var test4=[{"lng":116.700081,"lat":40.043932},{"lng":116.716179,"lat":39.967001},{"lng":117.11977,"lat":39.999729},{"lng":117.020884,"lat":40.112831},{"lng":116.861058,"lat":40.132252},{"lng":116.603496,"lat":40.092522},{"lng":116.603496,"lat":40.092522},{"lng":116.603496,"lat":40.092522}]
            var obj=[
                        {
                            id:"1",
                            position:test1,
                            editor:false,
                            showname:true,
                            name:"大网格1",
                            styleOption:{
                                strokeColor:"yellow",
                                fillColor:"yellow", 
                            },
                            styleName:{
                                color : "white",
                            },
                        },
                        {
                            id:"2",
                            position:test2,
                            editor:true,
                            name:'网格2'
                        },
                        {
                            id:"3",
                            position:test3,
                            editor:false,
                            name:"大网格3",
                            styleOption:{
                                strokeColor:"blue",
                                fillColor:"blue", 
                            }
                        }
                        ,
                        {
                            id:"4",
                            name:"大网格4",
                            position:test4,
                            styleName:{
                                color : "white",
                                fontSize : "50px",
                                height : "20px",
                                lineHeight : "20px",
                                fontFamily:"微软雅黑"
                            },
                            editor:false,
                            styleOption:{
                                strokeColor:"green",
                                fillColor:"green", 
                            }
                        }
                    ]
         var map=mapGis("container",{
            styleoption:{
                strokeColor:"green",
                fillColor:"#000",   
            },
            toolShow:true,
            btnContent:"新建",
            
         },function(data){
            //map.clearalloverlays();
            console.log(data,"data");
            $("body").append("<pre>"+JSON.stringify(data)+"</pre>");
        });
        map.drawGird(obj);
        });
        
    </script>
</body>
</html>